export default function setButtonStatus(button,orgVal) {
    let flag = true;
    if (!!orgVal) {
        flag = !!orgVal.refpk;
    }
    this.props.button.setButtonVisible({
        save: button === 'add' || button === 'edit',
        saveAdd: button === 'add' || button === 'edit',
        cancel: button === 'add' || button === 'edit',
        newAdd: (button === 'main' || button ==='afterSave') && flag ,
        print: button === 'main' && flag ,
        query: button === 'main' && flag,
        print_group: button === 'main' && flag,
        template_print: button ==='afterSave' && flag ,
        refresh: (button === 'main' || button ==='afterSave') && flag ,
        delete: (button ==='afterSave') && flag ,
        edit: (button ==='afterSave') && flag,
        file: (button ==='afterSave') && flag
    });

    this.props.button.setButtonDisabled({
        saveAdd: button === 'edit',
        edit: !flag ,
        delete: !flag
    });
}
